﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WingIt.Utility
{
    [RevisionControlId("$Id: WingItMath.cs 684 2012-08-08 10:09:07Z Chinajade $")]
    class WingItMath
    {
        private static Buddy.Common.Math.Vector3 Centerpoint(IEnumerable<Buddy.Common.Math.Vector3> pointCluster)
        {
            int     count   = 0;
            float   sumX    = 0.0f;
            float   sumY    = 0.0f;
            float   sumZ    = 0.0f;

            foreach (var point in pointCluster)
            {
                sumX += point.X;
                sumY += point.Y;
                sumZ += point.Z;
                ++count;
            }

            if (count == 0)
                { return Buddy.Common.Math.Vector3.Zero; }

            return new Buddy.Common.Math.Vector3(sumX/count, sumY/count, sumZ/count);
        }
    }
}
